package com.my.study.io;

import java.io.*;

/**
 * @author Carlos
 * @version 1.0
 * @Description 节点流处理 拷贝
 * @date 2021/6/27 9:37
 **/
public class BufferedNodeCopyTest {

    private static final String SRC_PATH = "D:/file/ReentrantLock.png";

    private static final String DEST_PATH = "D:/file/ReentrantLock1.png";

    public static void main(String[] args) {
        byte[] buf = new byte[1024];
        int readLen = 0;
        try (BufferedInputStream in = new BufferedInputStream(new FileInputStream(SRC_PATH));
             BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(DEST_PATH))) {

            while ((readLen = in.read(buf)) != -1) {
                out.write(buf, 0, readLen);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
